import { myRequest} from '../utils/request.js'
const userId=uni.getStorageSync('userId')
//  创建订单
export function createOrderAPI(data,orderType='2') {
	
	let obj={
		"1":"/app-api/member/order/createCleaning",
		"2":"/app-api/member/order/create",
		"3":"/app-api/member/order/create"
	}
	return myRequest({
		url: obj[orderType],
		data,
		method: "POST"
	})
}
//  确认支付
export function updatePayOrderAPI(data) {
	return myRequest({
		url: "/app-api/member/order/updatePayChannelCode",
		data,
		method: "POST"
	})
}
// 订单列表
export function orderListAPI(data) {
	return myRequest({
		url: "/app-api/member/order/page",
		data,
		method: "GET"
	})
}
// 取消订单 1.待付款-取消订单 2.已发布-取消订单3.待服务-取消订单
export function cancelOrderAPI(data,cancelType) {
	let obj={
		"1":"/app-api/member/order/cancel",
		"2":"/app-api/member/order/cancelOrder",
		"3":"/app-api/member/order/waitCancelOrder"
	}
	return myRequest({
		url:obj[cancelType],
		data,
		method: "POST"
	})
}
// 获得交易订单
export function orderdetailAPI(data) {
	return myRequest({
		url: "/app-api/member/order/get-detail",
		data,
		method: "GET"
	})
}
// 获得交易订单
export function cancelOrderWaitingAPI(data) {
	return myRequest({
		url: "/app-api/member/order/cancelOrderWaiting",
		data,
		method: "GET"
	})
}
// updateOrder
export function updateOrderAPI(data) {
	return myRequest({
		url: "/app-api/member/order/updateOrder",
		data,
		method: "POST"
	})
}
// 提前结束订单
export function earlyTerminationOrderAPI(data) {
	return myRequest({
		url: "/app-api/member/order/earlyTerminationOrder",
		data,
		method: "POST"
	})
}
// 服务验收列表
export function serviceAcceptanceAPI(data) {
	return myRequest({
		url: "/app-api/member/order/serviceAcceptance",
		data,
		method: "GET"
	})
}
// 确认交易订单验收
export function  receiveOrderAPI(data) {
	return myRequest({
		url: "/app-api/member/order/receive",
		data,
		method: "POST"
	})
}
// 确认交易订单验收
export function  deleteOrderAPI(data) {
	return myRequest({
		url: "/app-api/member/order/delete?id="+data.id,
		 
		method: "DELETE"
	})
}
// 工程类 保洁类订单指定人员需要计算交通补贴 传入公里数
export function settlementAPI(data) {
	return myRequest({
		url: "/app-api/member/order/settlement",
		data,
		method: "GET"
	})
}
//  分类
export function categoryListAPI(data) {
	return myRequest({
		url: "/app-api/member/category/categoryList",
		data,
		method: "POST"
	})
}
//  父id查子id
export function getdetailcleaningAPI(data) {
	return myRequest({
		url: "/app-api/member/order/get-detail-cleaning",
		data,
		method: "get"
	})
}
//   保洁单 --父类 确认支付接口
export function payCleaningAPI(data) {
	return myRequest({
		url: "/app-api/member/order/updatePayChannelCodeCleaning",
		data,
		method: "POST"
	})
}
//   保洁单 -- 确认支付接口
export function payoneCleaningAPI(data) {
	return myRequest({
		url: "/app-api/member/order/updatePayChannelCode",
		data,
		method: "POST"
	})
}
//  员工转单订单申请
export function staffTransferOrderAPI(data) {
	return myRequest({
		url: "/app-api/member/order/staffTransferOrder",
		data,
		method: "GET"
	})
}
//  员工取消订单申请
export function staffCancelOrderAPI(data) {
	return myRequest({
		url: "/app-api/member/order/staffCancelOrder",
		data,
		method: "GET"
	})
}
//  订单修改申请
export function updateOrderApplyAPI(data) {
	return myRequest({
		url: "/app-api/member/order/updateOrderApply",
		data,
		method: "GET"
	})
}
//  申请售后
export function aftersaleAPI(data) {
	return myRequest({
		url: "/app-api/member/after-sale/create",
		data,
		method: "POST"
	})
}
//  取消售后
export function aftersalecancelAPI(data) {
	return myRequest({
		url: "/app-api/member/after-sale/cancel?id="+data.id,
		data,
		method: "DELETE"
	})
}
// 售后
export function orderAfterAgreeAPI(type, data) {
	return myRequest({
		url: '/app-api/member/order/'+type,
		data ,
		method: "POST"
	})
}
// 获得未使用的平台优惠劵列表
export function systemCouponAPI(data) {
	return myRequest({
		url: '/app-api/member/coupon/systemCoupon',
		data ,
		method: "POST"
	})
}
// 获得未使用的员工优惠劵列表
export function getStaffCouponAPI(data) {
	return myRequest({
		url: '/app-api/member/coupon/getStaffCoupon',
		data ,
		method: "POST"
	})
}
// 获得未使用的商户优惠劵列表
export function getMerchantCouponAPI(data) {
	return myRequest({
		url: '/app-api/member/coupon/getMerchantCoupon',
		data ,
		method: "POST"
	})
}
// 交通补贴说明
export function transportationAllowanceAPI(data) {
	return myRequest({
		url: '/app-api/member/order/transportationAllowance',
		data ,
		method: "GET"
	})
}